package com.yunche.yunchebusiness.utils

import android.text.InputFilter
import android.view.View
import android.widget.EditText


/**
 * Create by Crcker on 2018/10/17 15:43
 * Email: Crcker@163.com
 */


object ViewHelper {

    fun setVisibility(isVisible: Boolean, view: View?) {
        if (view == null) return
        when (isVisible) {
            true -> view.visibility = View.VISIBLE
            false -> view.visibility = View.GONE
        }
    }

    fun setInputMaxLength(length: Int, view: EditText?) {
        val filters = arrayOf<InputFilter>(InputFilter.LengthFilter(length))
        view?.filters = filters


    }
}